package com.chain.BrotherExchange.data.model;

import com.chain.BrotherExchange.R;

import java.io.Serializable;
import java.text.DecimalFormat;
import java.util.List;

public class ExtractMoneyDetails extends BaseResponseModel<ExtractMoneyDetails.DataBean> {

    public static class DataBean {
        /**
         * list : {"page_index":1,"page_size":10,"total_page":1,"total":9,"items":[{"id":79,"token_id":1,"token_name":"USDT","amount":"1","fee":"0.002","address":"mzWZhc8MKSBSmfH9SPF7Yg97mfDFGdLyBR","remarks":"","states":3,"create_time":1539860471},{"id":75,"token_id":2,"token_name":"BTC","amount":"1","fee":"0.002","address":"0xbd89aa102b40518bcdd168fedee1a833416ca3a8","remarks":"","states":3,"create_time":1539855039},{"id":74,"token_id":2,"token_name":"BTC","amount":"1","fee":"0.002","address":"0xbd89aa102b40518bcdd168fedee1a833416ca3a8","remarks":"","states":3,"create_time":1539853564},{"id":73,"token_id":2,"token_name":"BTC","amount":"1","fee":"0.002","address":"0xbd89aa102b40518bcdd168fedee1a833416ca3a8","remarks":"","states":3,"create_time":1539853555},{"id":72,"token_id":2,"token_name":"BTC","amount":"1","fee":"0.002","address":"0xbd89aa102b40518bcdd168fedee1a833416ca3a8","remarks":"","states":3,"create_time":1539850662},{"id":71,"token_id":2,"token_name":"BTC","amount":"1","fee":"0.002","address":"0xbd89aa102b40518bcdd168fedee1a833416ca3a8","remarks":"","states":3,"create_time":1539850660},{"id":70,"token_id":2,"token_name":"BTC","amount":"1","fee":"0.002","address":"0xbd89aa102b40518bcdd168fedee1a833416ca3a8","remarks":"","states":3,"create_time":1539850640},{"id":69,"token_id":2,"token_name":"BTC","amount":"1","fee":"0.002","address":"0xbd89aa102b40518bcdd168fedee1a833416ca3a8","remarks":"","states":3,"create_time":1539850622},{"id":68,"token_id":2,"token_name":"BTC","amount":"1","fee":"0.002","address":"0xbd89aa102b40518bcdd168fedee1a833416ca3a8","remarks":"","states":3,"create_time":1539850602}]}
         */

        private ListBean list;

        public DataBean() {
        }

        public DataBean(ListBean list) {

            this.list = list;
        }

        public ListBean getList() {
            return list;
        }

        public void setList(ListBean list) {
            this.list = list;
        }

        public static class ListBean {
            public ListBean() {
            }

            public ListBean(List<ItemsBean> items) {

                this.items = items;
            }

            /**
             * page_index : 1
             * page_size : 10
             * total_page : 1
             * total : 9
             * items : [{"id":79,"token_id":1,"token_name":"USDT","amount":"1","fee":"0.002","address":"mzWZhc8MKSBSmfH9SPF7Yg97mfDFGdLyBR","remarks":"","states":3,"create_time":1539860471},{"id":75,"token_id":2,"token_name":"BTC","amount":"1","fee":"0.002","address":"0xbd89aa102b40518bcdd168fedee1a833416ca3a8","remarks":"","states":3,"create_time":1539855039},{"id":74,"token_id":2,"token_name":"BTC","amount":"1","fee":"0.002","address":"0xbd89aa102b40518bcdd168fedee1a833416ca3a8","remarks":"","states":3,"create_time":1539853564},{"id":73,"token_id":2,"token_name":"BTC","amount":"1","fee":"0.002","address":"0xbd89aa102b40518bcdd168fedee1a833416ca3a8","remarks":"","states":3,"create_time":1539853555},{"id":72,"token_id":2,"token_name":"BTC","amount":"1","fee":"0.002","address":"0xbd89aa102b40518bcdd168fedee1a833416ca3a8","remarks":"","states":3,"create_time":1539850662},{"id":71,"token_id":2,"token_name":"BTC","amount":"1","fee":"0.002","address":"0xbd89aa102b40518bcdd168fedee1a833416ca3a8","remarks":"","states":3,"create_time":1539850660},{"id":70,"token_id":2,"token_name":"BTC","amount":"1","fee":"0.002","address":"0xbd89aa102b40518bcdd168fedee1a833416ca3a8","remarks":"","states":3,"create_time":1539850640},{"id":69,"token_id":2,"token_name":"BTC","amount":"1","fee":"0.002","address":"0xbd89aa102b40518bcdd168fedee1a833416ca3a8","remarks":"","states":3,"create_time":1539850622},{"id":68,"token_id":2,"token_name":"BTC","amount":"1","fee":"0.002","address":"0xbd89aa102b40518bcdd168fedee1a833416ca3a8","remarks":"","states":3,"create_time":1539850602}]
             */

            private int page_index;
            private int page_size;
            private int total_page;
            private int total;
            private List<ItemsBean> items;

            public int getPage_index() {
                return page_index;
            }

            public void setPage_index(int page_index) {
                this.page_index = page_index;
            }

            public int getPage_size() {
                return page_size;
            }

            public void setPage_size(int page_size) {
                this.page_size = page_size;
            }

            public int getTotal_page() {
                return total_page;
            }

            public void setTotal_page(int total_page) {
                this.total_page = total_page;
            }

            public int getTotal() {
                return total;
            }

            public void setTotal(int total) {
                this.total = total;
            }

            public List<ItemsBean> getItems() {
                return items;
            }

            public void setItems(List<ItemsBean> items) {
                this.items = items;
            }

            public static class ItemsBean implements Serializable {
                public ItemsBean(String token_name, String amount, String fee, int states, int create_time) {
                    this.token_name = token_name;
                    this.amount = amount;
                    this.fee = fee;
                    this.states = states;
                    this.create_time = create_time;
                }

                public ItemsBean() {
                }

                /**
                 * id : 79
                 * token_id : 1
                 * token_name : USDT
                 * amount : 1
                 * fee : 0.002
                 * address : mzWZhc8MKSBSmfH9SPF7Yg97mfDFGdLyBR
                 * remarks :
                 * states : 3
                 * create_time : 1539860471
                 */

                private int id;
                private int token_id;
                private String token_name;
                private String amount;
                private String fee;
                private String address;
                private String remarks;
                private int states;
                private int create_time;

                public int getId() {
                    return id;
                }

                public void setId(int id) {
                    this.id = id;
                }

                public int getToken_id() {
                    return token_id;
                }

                public void setToken_id(int token_id) {
                    this.token_id = token_id;
                }

                public String getToken_name() {
                    return token_name;
                }

                public void setToken_name(String token_name) {
                    this.token_name = token_name;
                }

                public String getAmount() {
                    return amount;
                }

                public void setAmount(String amount) {
                    this.amount = amount;
                }

                public String getFee() {
                    return fee;
                }

                public String accountNumber() {
                    DecimalFormat df = new DecimalFormat("########.########");
                    return df.format(Double.parseDouble(amount) - Double.parseDouble(fee));
                }

                public void setFee(String fee) {
                    this.fee = fee;
                }

                public String getAddress() {
                    return address;
                }

                public void setAddress(String address) {
                    this.address = address;
                }

                public String getRemarks() {
                    return remarks;
                }

                public void setRemarks(String remarks) {
                    this.remarks = remarks;
                }

                public int getStates() {
                    return states;
                }

                public void setStates(int states) {
                    this.states = states;
                }

                public int getCreate_time() {
                    return create_time;
                }

                public void setCreate_time(int create_time) {
                    this.create_time = create_time;
                }

                /**
                 * 1正在提币，2 已完成，3提币已取消，4提币失败，5审核通过，6审核撤销
                 */
                public int getStateText() {
                    switch (states) {
                        case 1:
                            return R.string.in_review;
                        case 2:
                            return R.string.succeed;
                        case 3:
                            return R.string.cancel;
                        case 4:
                            return R.string.failure;
                        case 5:
                            return R.string.pass;
                        default:
                            return R.string.no_pass;
                    }
                }

                public int getStateDrawable() {
                    switch (states) {
                        case 1:
                            return R.drawable.ic_in_review_state;
                        case 2:
                            return R.drawable.ic_success_state;
                        case 4:
                            return R.drawable.ic_extract_money_failure_state;
                        default:
                            return R.drawable.ic_extract_money_cancel_state;
                    }
                }

                public boolean isCancel() {
                    return states == 1;
                }
            }
        }
    }
}
